//
// Created by 32513 on 25-2-11.
//

#ifndef CHASSIS_H
#define CHASSIS_H

/*Define Here*/
#define MOTOR_NUM 2
#define GM310_RATIO 100
// #include "stm32f4xx_hal_tim.h"
#include <tim.h>


typedef enum Motor_Error
{
    MOTOR_OK = 0,
    MOTOR_ERROR = -1,
} Motor_Error;

typedef struct motor_config
{
    TIM_HandleTypeDef *tim_handle;  //电机脉冲编码器对应的TIM句柄
    int16_t ratio;  //电机减速比与每圈脉冲数的乘积，输出轴一圈的脉冲数
}motor_config_t;

typedef struct motor
{
    /*Config*/
    TIM_HandleTypeDef *tim_handle;
    int16_t ratio;
    /*Measure*/
    int32_t ecd;
    int32_t ecd_last;
    int16_t speed_rpm;
    float Angle;
    int32_t total_r;
}motor_t;
#endif //CHASSIS_H
